<template>
  <el-dialog
    top="30px"
    width="800px"
    title="项目立项"
    append-to-body
    :close-on-click-modal="false"
    :before-close="beforeClose"
    :visible.sync="visible"
  >
    <approve-edit
      @close="beforeClose"
      v-bind="$attrs"
      v-on="$listeners"
      ref="main"
      @success="handleSuccess"
    ></approve-edit>
  </el-dialog>
</template>

<script>
import ApproveEdit from '@/bigcredit/views/self/fast/item/components/ApproveEdit'
export default {
  components: {
    ApproveEdit,
  },
  props: {
    visible: Boolean,
  },
  data() {
    return {}
  },

  created() {},
  computed: {},
  watch: {
    visible(val) {
      if (val) {
        this.$nextTick(() => {
          this.$refs.main.getRelatedData(true)
        })
      }
    },
  },
  methods: {
    beforeClose() {
      this.$emit('update:visible', false)
    },
    handleSuccess() {
      this.$emit('success', true)
    },
  },
}
</script>
<style lang="scss" scoped></style>
